Conversation
ozanunal0
commented
Jul 9, 2025
- Import APIKey model in database.py to register with SQLModel metadata
- Update docker-compose.yml to mount full project directory (.:/code)
- Remove version specification and add shared network configuration
- Database file now created automatically during container startup
- Eliminates need for manual database initialization
- Import APIKey model in database.py to register with SQLModel metadata - Update docker-compose.yml to mount full project directory (.:/code) - Remove version specification and add shared network configuration - Database file now created automatically during container startup - Eliminates need for manual database initialization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes automatic database creation in Docker containers by ensuring all SQLModel tables are properly registered and adjusting the Docker volume mounting strategy. The changes eliminate the need for manual database initialization when running the application in containers.
- Import APIKey model in database.py to register it with SQLModel metadata for automatic table creation
- Update Docker Compose configuration to mount the full project directory and add shared networking
- Remove deprecated version specification from docker-compose.yml
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| app/database.py | Adds APIKey model import to ensure table registration with SQLModel metadata |
| docker-compose.yml | Updates volume mounting strategy, removes version spec, and adds shared network configuration |
| - .env | ||
| volumes: | ||
| - ./gateway.db:/code/gateway.db | ||
| - .:/code |
There was a problem hiding this comment.
Mounting the entire project directory (.:/code) into the container can expose sensitive files and create security risks. Consider mounting only necessary files or using a .dockerignore file to exclude sensitive content.
|
|
||
| networks: | ||
| shared-app-network: | ||
| external: true |
There was a problem hiding this comment.
Using an external network requires manual creation before running docker-compose. Consider using a regular network definition or document the network creation requirement in the deployment instructions.
| external: true | |
| driver: bridge |
| # Import all models to register them with SQLModel metadata | ||
| from app.db_models.api_key import APIKey |
There was a problem hiding this comment.
[nitpick] Importing models solely for registration creates implicit dependencies that may be overlooked during refactoring. Consider using a dedicated model registry function or importing all models in a centralized location.
| # Import all models to register them with SQLModel metadata | |
| from app.db_models.api_key import APIKey | |
| # Function to register all models with SQLModel metadata | |
| def register_models(): | |
| from app.db_models.api_key import APIKey | |
| # Add other models here as needed |


